<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="./js/jquery.min.js"></script>
    <script>
        $(function () {
            var list = [];
            function getData() {
                let p = new Promise((resolve, reject) => {
                    $.get('./json/01.json', (data) => {
                        resolve(data);
                    })
                })
                return p;
            }

            // function test() {
            //     getData().then(res => {
            //         console.log(res);
            //         list = res.matchedProducts;
            //         //渲染...
            //     })
            // }
            // test();

            async function hello1() {
                //await 等待 ,等待这个异步操作结束后，程序才能继续运行
                var data = await getData();
                console.log(data);
                list = res.matchedProducts;
            }
            hello1();
        })


    </script>
</body>

</html>